package acwing._2LanQiao._11No11;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._2LanQiao._11No11
 * @File : Q2875.java
 * @Author : WangRuoyu
 * @Date 2023/3/27 22:39
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q2875 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);
        long res = 0;
        long[] d = new long[n];
        long[] f = new long[n];

        for (int i = 0; i < n; i++) {
            long x = Long.parseLong(words[i]);
            d[i] = x;
            if (i > 0) {
                f[i] = f[i - 1] + d[i - 1];
            }
            res += d[i] * f[i];
        }

        System.out.println(res);
    }
}